package com.linkai.controller.admin.info;

import com.linkai.controller.admin.BaseController;
import com.linkai.entity.Bstore;
import com.linkai.enums.ResultDTO;
import com.linkai.service.BstoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author yamon
 * @Date 2020-12-02 21:00
 * @Description
 * @Version 1.0
 */
@Controller
@RequestMapping("/admin/info/store")
public class BackStoreController extends BaseController implements InfoBaseController{
    @Autowired
    private BstoreService bstoreService;

    /**
     * 保存分类
     *
     * @return boolean
     */
    @Override
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    @ResponseBody
    public ResultDTO<Boolean> saveSize(String sizeDesc) {
        final Bstore entity = new Bstore();
        entity.setBstoTitle(sizeDesc);
        return super.successSaveInfo(bstoreService.save(entity));
    }
    /**
     * 显示所有的分类
     *
     * @return boolean
     */
    @Override
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public List<Bstore> listAll() {
        return bstoreService.list();
    }
}
